@rem ===== This test is executed from test.bat ======
@echo on

if not exist test1.bat goto nocd
cd bin\win32
"%1" = "EXTEND"
:nocd


@echo ########### 2 palette image #############
@rem Direct support: BMP, DIB, GIF, PCX, PNG, RAS(SUN), TGA, TIF, XPM

gconvert ..\..\images\PEPPER3.bmp test_A.bmp /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\PEPPER3.bmp test_A.bmp /s
@if not errorlevel 0 goto error

gconvert ..\..\images\PEPPER3.bmp test_A.dib /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\PEPPER3.bmp test_A.dib /s
@if not errorlevel 0 goto error

gconvert test_A.bmp test_A.ftg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\PEPPER3.bmp test_A.ftg /s
@if not errorlevel 0 goto error

gconvert test_A.bmp test_A.gif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\PEPPER3.bmp test_A.gif /s
@if not errorlevel 0 goto error

gconvert test_A.bmp test_A.pcx /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\PEPPER3.bmp test_A.pcx /s
@if not errorlevel 0 goto error

gconvert test_A.bmp test_A.png /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\PEPPER3.bmp test_A.png /s
@if not errorlevel 0 goto error

gconvert test_A.bmp test_A.ras /Format ras#SUN /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\PEPPER3.bmp test_A.ras /s
@if not errorlevel 0 goto error

gconvert test_A.bmp test_A.tga /s
@if not errorlevel 0 goto errorc
gcomp test_A.gif test_A.tga /IDX /s
@if not errorlevel 0 goto error

gconvert test_A.bmp test_A.tif /s
@if not errorlevel 0 goto errorc
gcomp test_A.tga test_A.tif /IDX /s
@if not errorlevel 0 goto error

gconvert test_A.bmp test_A.xpm /s
@if not errorlevel 0 goto errorc
gcomp test_A.gif test_A.xpm /s
@if not errorlevel 0 goto error


@rem ----- limited size <256*256 -----
gconvert test_A.bmp test_A1.bmp -s -Resize 28%
@if not errorlevel 0 goto errorc
gconvert test_A1.bmp test_A1.ico -s
@if not errorlevel 0 goto errorc
gcomp test_A1.bmp test_A1.ico /s
@if not errorlevel 0 goto error


@rem #indirect

gconvert test_A.bmp test_A.txt /s
@if not errorlevel 0 goto errorc
gcomp test_A.gif test_A.txt /s
@if not errorlevel 0 goto error



@echo ########### 4 palette image #############
@rem Direct support: BMP, GIF, PNG, XPM, TIF

gconvert ..\..\images\HEX_Cnt.gif test_B.bmp /PeelFrame 1 /s

gconvert ..\..\images\HEX_Cnt.gif test_B.gif /PeelFrame 1 /s
@if not errorlevel 0 goto errorc
gcomp test_B.bmp test_B.gif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_B.ftg /PeelFrame 1 /s
@if not errorlevel 0 goto errorc
gcomp test_B.bmp test_B.ftg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_B.png /PeelFrame 1 /s
@if not errorlevel 0 goto errorc
gcomp test_B.bmp test_B.png /s
@if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_B.tif /PeelFrame 1 /s
@if not errorlevel 0 goto errorc
gcomp test_B.bmp test_B.tif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_B.xpm /PeelFrame 1 /s
@if not errorlevel 0 goto errorc
gcomp test_B.bmp test_B.xpm /s
@if not errorlevel 0 goto error

@rem #indirect

gconvert ..\..\images\HEX_Cnt.gif test_B.txt /PeelFrame 1 /s
@if not errorlevel 0 goto errorc
gcomp test_B.bmp test_B.txt /s
@if not errorlevel 0 goto error


@echo ########### 16 palette image #############
@rem Direct support: BMP, DIB, GIF, PCX, PNG, RAS#SUN, TIF, WPG, XPM
@rem Indirect support: TXT

gconvert ..\..\images\VGALOGO.rle test_C.bmp /s

@if not errorlevel 0 goto errorc
gcomp ..\..\images\VGALOGO.rle test_C.bmp /s
@if not errorlevel 0 goto error

@rem VGALOGO.rle is too big, only up to 256 x 256 size is supported
gconvert /resize 256x256 ..\..\images\VGALOGO.rle test_Cb.bmp
gconvert test_Cb.bmp test_C.ico /s
@rem @if not errorlevel 0 goto error
gcomp test_Cb.bmp test_C.ico /s
@rem @if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.dib /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.dib /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.ftg /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.ftg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.gif /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.gif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.pcx /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.pcx /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.png /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.png /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.ps /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.ps /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.ras /Format ras#SUN /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.ras /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.tif /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.tif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.xpm /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.xpm /s
@if not errorlevel 0 goto error

gconvert ..\..\images\VGALOGO.rle test_C.wpg /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.wpg /s
@if not errorlevel 0 goto error

@rem #indirect

gconvert ..\..\images\VGALOGO.rle test_C.txt /s
@if not errorlevel 0 goto errorc
gcomp test_C.bmp test_C.txt /s
@if not errorlevel 0 goto error


@echo ########### 256 palette image #############
@rem Direct support: BMP, DIB, EPS(ps), GIF, PCX, PNG, TGA, TIF, WPG, XPM

gconvert ..\..\images\assist.gif test_D.bmp /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.bmp /s
@if not errorlevel 0 goto error

gconvert ..\..\images\assist.gif test_D.dib /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.dib /s
@if not errorlevel 0 goto error

gconvert test_D.bmp test_D.ftg /s   
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.ftg /s 
@if not errorlevel 0 goto error

@rem @if "%1" == "EXTEND" goto SKIPFAILURE6
rem @if not errorlevel 0 goto error
:SKIPFAILURE6

gconvert ..\..\images\assist.gif test_D.gif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.gif /s
@if not errorlevel 0 goto error

gconvert test_D.bmp test_D.pcx /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.pcx /s
@if not errorlevel 0 goto error

gconvert test_D.bmp test_D.png /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.png /s
@if not errorlevel 0 goto error

gconvert ..\..\images\assist.gif test_D.ps /s
@if not errorlevel 0 goto errorc
gcomp test_D.bmp test_D.ps /s
@if not errorlevel 0 goto error

gconvert ..\..\images\assist.gif test_D.ras /Format ras#SUN /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.ras /s
@if not errorlevel 0 goto error

gconvert ..\..\images\assist.gif test_D.tga /s
@if not errorlevel 0 goto errorc
gcomp test_D.bmp test_D.tga /s
@if not errorlevel 0 goto error

@rem ===C++ only===
@rem @if not "%1" == "EXTEND" goto SKIPEX2

gconvert ..\..\images\assist.gif test_D.tif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.tif /s
@if not errorlevel 0 goto error

gconvert /Format txt#gm ..\..\images\assist.gif test_D.txt /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.txt /s
@if not errorlevel 0 goto error

gconvert ..\..\images\assist.gif test_D.wpg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.wpg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\assist.gif test_D.xpm /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\assist.gif test_D.xpm /s
@if not errorlevel 0 goto error


:SKIPEX2


@echo ########### 2 levels monochrome image #############

gconvert ..\..\images\lynne.pcx test_E.art /PeelPlane 7 /s
@if not errorlevel 0 goto errorc

gconvert ..\..\images\lynne.pcx test_E.bmp /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.art /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.ftg /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.ftg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.gif /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.gif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.jbg /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.jbg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.oko /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.oko /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.pcx /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.pcx /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.pbm /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.pbm /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.pdb /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.pdb /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.png /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.png /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.ps /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.ps /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.ras /Format ras#topoL /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.ras /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E2.ras /Format ras#SUN /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E2.ras /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.tga /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.tga /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.vif /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.vif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.wbmp /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.wbmp test_E.tga /s
@if not errorlevel 0 goto error


@rem ===C++ only===
@rem @if not "%1" == "EXTEND" goto SKIPEX_2MONO

gconvert ..\..\images\lynne.pcx test_E.tif /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.tif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.wpg /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.wpg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_E.xpm /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.xpm /s
@if not errorlevel 0 goto error

:SKIPEX_2MONO


@rem #indirect


@rem ===C++ only===
@rem @if not "%1" == "EXTEND" goto SKIPEX6

gconvert ..\..\images\lynne.pcx test_E.csv /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E.csv /s
@if not errorlevel 0 goto error

gconvert /Format txt#gm ..\..\images\lynne.pcx test_E1.txt /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E1.txt /s
@if not errorlevel 0 goto error

:SKIPEX6

gconvert /Format txt#plain ..\..\images\lynne.pcx test_E2.txt /PeelPlane 7 /s
@if not errorlevel 0 goto errorc
gcomp test_E.bmp test_E2.txt /s
@if not errorlevel 0 goto error



@echo ########### 16 levels gray image #############
@rem Direct support: OKO, TIF, PNG
@rem Indirect support (gray palette): BMP, GIF

gconvert /SeparateIDX ..\..\images\VGALOGO.rle test_F.oko /s
@if not errorlevel 0 goto errorc

gconvert /SeparateIDX ..\..\images\VGALOGO.rle test_F.ftg /s
@if not errorlevel 0 goto errorc
gcomp test_F.oko test_F.ftg /s
@if not errorlevel 0 goto error

@rem Different Size 1D needs to support crop.
@rem gconvert /SeparateIDX ..\..\images\VGALOGO.rle test_F.pdb /s
@rem @if not errorlevel 0 goto errorc
@rem gcomp test_F.oko test_F.pdb /s
@rem @if not errorlevel 0 goto error

gconvert /SeparateIDX ..\..\images\VGALOGO.rle test_F.jbg /s
@if not errorlevel 0 goto errorc
gcomp test_F.oko test_F.jbg /s
@if not errorlevel 0 goto error

gconvert /SeparateIDX ..\..\images\VGALOGO.rle test_F.pgm /s
@if not errorlevel 0 goto errorc
gcomp test_F.oko test_F.pgm /s
@if not errorlevel 0 goto error

gconvert test_F.pgm test_F.png /s
@if not errorlevel 0 goto errorc
gcomp test_F.oko test_F.png /s
@if not errorlevel 0 goto error

gconvert /SeparateIDX ..\..\images\VGALOGO.rle test_F.ras /Format ras#SUN /s
@if not errorlevel 0 goto errorc
gcomp test_F.oko test_F.ras /s
@if not errorlevel 0 goto error

gconvert /SeparateIDX ..\..\images\VGALOGO.rle test_F.tif /s
@if not errorlevel 0 goto errorc
gcomp test_F.oko test_F.tif /s
@if not errorlevel 0 goto error

@rem Indirect

gconvert test_F.oko test_F.bmp /s
@if not errorlevel 0 goto errorc
gcomp test_F.tif test_F.bmp /s
@if not errorlevel 0 goto error

gconvert test_F.oko test_F.gif /s
@if not errorlevel 0 goto errorc
gcomp test_F.tif test_F.gif /s
@if not errorlevel 0 goto error


@echo ########### 256 levels gray image #############

gconvert ..\..\images\lynne.pcx test_G.bmp /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.bmp /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.ftg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.ftg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.gif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.gif /s
@if not errorlevel 0 goto error

gconvert /resize 256x256 ..\..\images\lynne.pcx test_Gb.bmp /s
gconvert test_Gb.bmp test_G.ico /s
@if not errorlevel 0 goto errorc
gcomp test_Gb.bmp test_G.ico /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.jbg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.jbg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.mat /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.mat /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.oko /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.oko /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.pcx /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.pcx /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.png /s
@if not errorlevel 0 goto errorc
gcomp test_G.png test_G.pcx /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.ps /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.ps /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.ras /Format ras#topoL /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.ras /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G2.ras /Format ras#SUN /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G2.ras /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.sgi /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.sgi /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.tga /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.tga /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.tif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.tif /s
@if not errorlevel 0 goto error

gconvert /Format txt#plain ..\..\images\lynne.pcx test_G.txt /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.txt /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.vif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.vif /s
@if not errorlevel 0 goto error

@rem ===C++ only===
@rem @if not "%1" == "EXTEND" goto SKIPEX1

gconvert ..\..\images\lynne.pcx test_G.csv /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.csv /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.fts /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.fts /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.pgm /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.pgm /s
@if not errorlevel 0 goto error

gconvert /Format txt#gm ..\..\images\lynne.pcx test_G.txt /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.txt /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.xpm /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.xpm /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lynne.pcx test_G.wpg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lynne.pcx test_G.wpg /s
@if not errorlevel 0 goto error


:SKIPEX1



@echo ########### 65536 levels gray image #############
@rem Direct support: BMP, FITS(fts), MAT, OKO, PNG, XPM

gconvert ..\..\images\lenaI16.mat test_H.ftg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lenaI16.mat test_H.ftg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.bmp /s
@if not errorlevel 0 goto errorc
gcomp test_H.ftg test_H.bmp /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.csv /s
@if not errorlevel 0 goto errorc
gcomp test_H.ftg test_H.csv /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.jbg /s
@if not errorlevel 0 goto errorc
gcomp test_H.ftg test_H.jbg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.mat /s
@if not errorlevel 0 goto errorc
gcomp test_H.ftg test_H.mat /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.oko /s
@if not errorlevel 0 goto errorc
gcomp test_H.ftg test_H.oko /s
@if not errorlevel 0 goto error

gconvert /Format txt#plain ..\..\images\lenaI16.mat test_H.txt /s
@if not errorlevel 0 goto errorc
gcomp test_H.mat test_H.txt /s
@if not errorlevel 0 goto error

@rem ===C++ only===
@rem @if not "%1" == "EXTEND" goto SKIPEX3

gconvert ..\..\images\lenaI16.mat test_H.fts /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lenaI16.mat test_H.fts /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.pgm /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lenaI16.mat test_H.pgm /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.png /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\lenaI16.mat test_H.png /s
@if not errorlevel 0 goto error

gconvert /Format txt#gm ..\..\images\lenaI16.mat test_H.txt /s
@if not errorlevel 0 goto errorc
gcomp test_H.mat test_H.txt /s
@if not errorlevel 0 goto error

@rem gconvert ..\..\images\lenaI16.mat test_H.sgi /s
@rem @if not errorlevel 0 goto errorc
@rem gcomp test_H.mat test_H.tif /s
@rem @if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.tif /s
@if not errorlevel 0 goto errorc
gcomp test_H.mat test_H.tif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.vif /s
@if not errorlevel 0 goto errorc
gcomp test_H.mat test_H.vif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\lenaI16.mat test_H.xpm /s
@if not errorlevel 0 goto errorc
gcomp test_H.mat test_H.xpm /s
@if not errorlevel 0 goto error


@echo ########### RGB 16 bit color image #############

gconvert ..\..\images\input_16.tga test_I.bmp /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\input_16.tga test_I.bmp /s
@if not errorlevel 0 goto error

gconvert ..\..\images\input_16.tga test_I.tga /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\input_16.tga test_I.tga /s
@if not errorlevel 0 goto error

gconvert ..\..\images\input_16.tga test_I.tif /s
@if not errorlevel 0 goto errorc
gcomp test_I.tga test_I.tif /s
@if not errorlevel 0 goto error




:SKIPEX3
@echo ########### RGB 24 bit color image #############
@rem Indirect support: AAI, AVS


gconvert ..\..\images\i24.bmp test_J.ftg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\i24.bmp test_J.ftg /s
@if not errorlevel 0 goto errorc

gconvert test_J.ftg test_J.bmp /s
@if not errorlevel 0 goto errorc
gcomp test_J.ftg test_J.bmp /s
@if not errorlevel 0 goto errorc

gconvert ..\..\images\i24.bmp test_J.bmp /s
@if not errorlevel 0 goto errorc

gconvert ..\..\images\i24.bmp test_J.ico /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.ico /s
@if not errorlevel 0 goto error

gconvert ..\..\images\i24.bmp test_J.mat /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.mat /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.qoi /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.qoi /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.pcx /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.pcx /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.eps /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.eps /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_4a.ras /Format ras#topoL /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_4a.ras /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_4b.ras /Format ras#SUN /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_4b.ras /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.sgi /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.sgi /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.tga /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.tga /s
@if not errorlevel 0 goto error


@rem ===C++ only===
@rem @if not "%1" == "EXTEND" goto SKIPEX4

gconvert /Format txt#gm test_J.bmp test_J.txt /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.txt /s
@if not errorlevel 0 goto error


gconvert test_J.bmp test_J.fts /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.fts /s
@if not errorlevel 0 goto error


gconvert test_J.bmp test_J.png /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.png /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.ppm /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.ppm /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.tif /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.tif /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.vif /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.vif /s
@if not errorlevel 0 goto error


@rem -------------- indirect ----------------

gconvert test_J.bmp test_J.aai /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.aai /s
@if not errorlevel 0 goto error

gconvert test_J.bmp test_J.avs /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.avs /s
@if not errorlevel 0 goto error


:SKIPEX4


@rem -------------- Fuzzy ----------------

gconvert ..\..\images\i24.bmp test_J.jpg /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.jpg /s /Fuzzy
@if not errorlevel 0 goto error

gconvert ..\..\images\i24.bmp test_J.webp /s
@if not errorlevel 0 goto errorc
gcomp test_J.bmp test_J.webp /s /Fuzzy
@if not errorlevel 0 goto error



@echo ########### ARGB 32 bit color image #############
@rem Direct support: AAI, AVS, BMP, PCX, PNG, TIFF

gconvert ..\..\images\gracehop.bmp test_K.aai /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_K.aai /s
@if not errorlevel 0 goto error

gconvert ..\..\images\gracehop.bmp test_K.avs /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_K.avs /s
@if not errorlevel 0 goto error

gconvert ..\..\images\gracehop.bmp test_K.pcx /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_K.pcx /s
@if not errorlevel 0 goto error

gconvert ..\..\images\gracehop.bmp test_K.png /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_K.png /s
@if not errorlevel 0 goto error

gconvert ..\..\images\gracehop.bmp test_K.sgi /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_K.sgi /s
@if not errorlevel 0 goto error

gconvert ..\..\images\gracehop.bmp test_K.tif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_K.tif /s
@if not errorlevel 0 goto error

gconvert /Format txt#gm ..\..\images\gracehop.bmp test_K.txt /s
@if not errorlevel 0 goto errorc
gcomp test_K.pcx test_K.txt /s
@if not errorlevel 0 goto error

gconvert ..\..\images\gracehop.bmp test_K.vif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_K.vif /s
@if not errorlevel 0 goto error



@echo ############# Floats ###################

gconvert ..\..\images\floatmsb.fts test_L.csv /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\floatmsb.fts test_L.csv /s
@if not errorlevel 0 goto error

gconvert ..\..\images\floatmsb.fts test_L.fts /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\floatmsb.fts test_L.fts /s
@if not errorlevel 0 goto error

gconvert test_L.fts test_L.mat /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\floatmsb.fts test_L.fts /s
@if not errorlevel 0 goto error

gconvert /Format txt#plain ..\..\images\floatmsb.fts test_L.txt /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\floatmsb.fts test_L.txt /s
@if not errorlevel 0 goto error

gconvert test_L.fts test_L.vif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\floatmsb.fts test_L.vif /s
@if not errorlevel 0 goto error



@echo ############# Doubles ###################

@rem ===C++ only===
@rem @if not "%1" == "EXTEND" goto SKIPEX5

gconvert ..\..\images\double.mat test_M.csv /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\double.mat test_M.csv /s
@if not errorlevel 0 goto error

gconvert ..\..\images\double.mat test_M.fts /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\double.mat test_M.fts /s
@if not errorlevel 0 goto error

gconvert test_M.fts test_M.mat /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\double.mat test_M.fts /s
@if not errorlevel 0 goto error

gconvert /Format txt#plain ..\..\images\double.mat test_M.txt /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\double.mat test_M.txt /s
@if not errorlevel 0 goto error

gconvert test_M.fts test_M.vif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\double.mat test_M.vif /s
@if not errorlevel 0 goto error


:SKIPEX5


@echo ############# Multiple frames ###################


gconvert ..\..\images\HEX_Cnt.gif test_N.bmp /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\HEX_Cnt.gif test_N.bmp /s
@if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_N.ftg /s
@if not errorlevel 0 goto errorc
gcomp test_N.bmp test_N.ftg /s
@if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_N.gif /s
@if not errorlevel 0 goto errorc
gcomp test_N.bmp test_N.gif /s
@if not errorlevel 0 goto error

@rem Gray only
@rem gconvert ..\..\images\HEX_Cnt.gif test_N.mat /s
@rem @if not errorlevel 0 goto errorc
@rem gcomp test_N.bmp test_N.mat /s
@rem @if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_N.tga /s
@if not errorlevel 0 goto errorc
gcomp test_N.gif test_N.tga /s
@if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_N.tif /s
@if not errorlevel 0 goto errorc
gcomp test_N.gif test_N.tif /s
@if not errorlevel 0 goto error

gconvert ..\..\images\HEX_Cnt.gif test_N.txt /s
@if not errorlevel 0 goto errorc
gcomp test_N.gif test_N.txt /s
@if not errorlevel 0 goto error


@echo ############# Palette quantisation ###################

gconvert ..\..\images\i24.bmp test_Z.gif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\i24.bmp test_Z.gif /s /fuzzy 250
@if not errorlevel 0 goto errorc


gconvert ..\..\images\i24.bmp test_Z.wpg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\i24.bmp test_Z.wpg /s /fuzzy 250
@if not errorlevel 0 goto errorc


gconvert ..\..\images\gracehop.bmp test_Z2.gif /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_Z2.gif /s /fuzzy 250
@if not errorlevel 0 goto errorc

gconvert ..\..\images\gracehop.bmp test_Z2.wpg /s
@if not errorlevel 0 goto errorc
gcomp ..\..\images\gracehop.bmp test_Z2.wpg /s /fuzzy 250
@if not errorlevel 0 goto errorc



@echo ############# END OF TESTS ###################


@echo off
@echo ###############################################

@echo on
@rem del test_?.*

del test_?.*
del test_??.*

@echo off
goto done

:errorc
@echo off
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo convert of image has been failed
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
goto done

:error
@echo off
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo Test procedure has been failed.
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

:done

